{if $isTabbed == "false"}
    <h1>{$folder->getLabel()}</h1>

    <div id="folderLang" style="display:none">{$folder->getLang()}</div>
    <div id="folderId" style="display:none">{$folder->getUniqueId()}</div>

    <div id="moduleTabs">
         <ul>
             <li><a href="{$URL_RELATIVE}/bo/#{$fileLink}" title="{t}Media{/t}" rel="history"><span>{t}Media{/t}</span></a></li>
             <li><a href="{$URL_RELATIVE}/bo/#{$paramsLink}" title="{t}Dimensions{/t}" rel="history"><span>{t}Dimensions{/t}</span></a></li>
             {hasRight rule=medias_Edit}
             {hasDocRight document=$folder module="medias" rule="edit"}
             <li><a href="{$URL_RELATIVE}/bo/#{$propertiesLink}" title="{t}Properties{/t}" rel="history"><span>{t}Properties{/t}</span></a></li>
             {/hasDocRight}
             {/hasRight}
         </ul>
    </div>

    <div id="ajaxTabLoader"><div id="loaderTabPic">{backend_image file="ajax-loader-big.gif"}</div></div>
{/if}

<div id="tabContent">
	{if $tabName == "files" || $tabName == ""}
		{if $nbMedias == 0}
        <div class="emptyFolder">
            {icon name="info.png"} {t}This folder is empty{/t}{hasRight rule=medias_Add} - <a href="{$URL_RELATIVE}/bo/#{url route=addMedia docId=$folder->getUniqueId() docLang=$folder->getLang()|lower}" class="greyButton nyroModal">{t}click here to add media{/t}</a> {t}in this folder{/t}{/hasRight}.
        </div>
        {elseif $medias == 'search'}
    <div class="emptyFolder">
        {t}No result{/t} - <a href="{$fileLink}" class="greyButton reload">{t}Click here to return{/t}</a>
    </div>
        {else}
    <div id="saveButton" style="display:block" >
        <ul class="saveButtons">
            {hasRight rule=medias_Add}
            <li class="first">
                <a href="{$URL_RELATIVE}/bo/#/?module=medias&action=AjaxDuplicateMedia" class="nyroModalResult toolTip" title="{t}Duplicate - Duplicate your documents in different folders.{/t}">{icon name="documents.png"} {t}Duplicate selection{/t}</a>
            </li>
            <li>
                <a href="{$URL_RELATIVE}/bo/#/?module=backoffice&action=AjaxMoveFolderContent" class="nyroModalResult toolTip" title="{t}Move - Move your media from a folder to another.{/t}">{icon name="menu_undo.png"} {t}Move selection{/t}</a>
            </li>
            {/hasRight}
            {hasRight rule=medias_Edit}
            <li>
                <a href="{$URL_RELATIVE}/bo/#/?module=backoffice&action=AjaxSwitchPublicationStatus" class="nyroModalResult toolTip" title="{t}Change status - Switch publication status of your selection.{/t}">{icon name="refresh.png"} {t}Change status{/t}</a>
            </li>
            {/hasRight}
            {hasRight rule=medias_Delete}
            <li>
                <a href="{$URL_RELATIVE}/bo/#/?module=backoffice&action=AjaxDeleteFolderContent" class="nyroModalResult delete toolTip" title="{t}Delete - Delete selected items and all their dimensions.{/t}">{t assignTo=iconTitle}Delete{/t}{icon name="delete2.png" title=$iconTitle} {t}Delete selection{/t}</a>
            </li>
            {/hasRight}
        </ul>
    </div>
    <div id="pagination">{block module="backoffice" action="AjaxPagination" nbDocTot=$pagination.nbDocTot nbDoc=$pagination.nbDoc numPage=$pagination.numPage}<div id="selectedelements"></div></div>
    <div id="documentListTableLoader"><div id="loaderPic">{backend_image file="ajax-loader-big.gif"}</div></div>
    <table class="documentListTable">
        <thead>
            <tr>
                <th style="width:40px"><input type="checkbox" class="checkAll select" /></th>
                <th style="width:40px"><a href="javascript:void(0);" class="{if $sortParams.column == "document_uid"}{$sortParams.class}{else}no-sort{/if}" title="{if $sortParams.column == "document_uid"}{$sortParams.order}{else}asc{/if}" name="document_uid">{t}ID{/t}</a></th>
                <th colspan="2">{t}Status{/t}</th>
                <th><a href="javascript:void(0);" class="{if $sortParams.column == "document_label"}{$sortParams.class}{else}no-sort{/if}" title="{if $sortParams.column == "document_label"}{$sortParams.order}{else}asc{/if}" name="document_label">{t}Label{/t}</a></th>
                <th>{t}Size{/t}</th>
                <th>{t}Weight{/t}</th>
                <th><a href="javascript:void(0);" class="{if $sortParams.column == "ext"}{$sortParams.class}{else}no-sort{/if}" title="{if $sortParams.column == "ext"}{$sortParams.order}{else}asc{/if}" name="ext">{t}Type{/t}</a></th>
                <th><a href="javascript:void(0);" class="{if $sortParams.column == "document_creationdate"}{$sortParams.class}{else}no-sort{/if}" title="{if $sortParams.column == "document_creationdate"}{$sortParams.order}{else}asc{/if}" name="document_creationdate">{t}Date{/t}</a></th>
            </tr>
            <tr class="searchBar">
                <th></th>
                <th></th>
                <th colspan="2"></th>
                <th><input type="text" name="title" value="{$docSearchParams.title}" /></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
            </tr>
        </thead>
        <tbody id="sortable">
            {foreach from=$medias key=key item=media}
            <tr id="{$media->getUniqueId()}">
                <td style="text-align: center;">
                    {backend_image file="mover.png" class="sortableIcon"}
                    {hasDocRight document=$media module="medias" rule="edit delete"}
                        <input type="checkbox" class="select" value="{$media->getUniqueId()}" name="check_rep[{$key}]" />
                    {hasDocRightElse}
                        <input type="checkbox" class="select" value="{$media->getUniqueId()}" name="check_rep[{$key}]" disabled />
                    {/hasDocRight}
                </td>
                <td class="noBackground" style="width:40px; text-align: center;">{$media->getUniqueId()}</td>
                <td class="noBackground" style="width:60px; text-align: center;">
                    <span class="listButtons">
                        {hasRight rule=medias_Delete}
                        {hasDocRight document=$media module="medias" rule="delete"}
                        <a href="{$URL_RELATIVE}/bo/#{url route='deleteMedias' docId=$media->getUniqueId() docLang=$media->getLang()}" class="nyroModal itemButton itemDeleteButton" title="{t}Delete{/t}"></a>
                        {/hasDocRight}
                        {/hasRight}
                        {hasRight rule=medias_Edit}
                        {hasDocRight document=$media module="medias" rule="edit"}
                        <a href="{$URL_RELATIVE}/bo/#{$media->getEditUrl($folder->getUniqueId())}" class="nyroModal itemButton itemEditButton" title="{t}Edit{/t}"></a>
                        {/hasDocRight}
                        {/hasRight}
                        <a href="{$URL_RELATIVE}/bo/#{url route='mediaViewImage' docId=$media->getUniqueId() docLang=$media->getLang() width='default' height='default'}" class="nyroModal itemButton itemViewButton defaultAction" title="{t}View{/t}"></a>
                    </span>
                </td>
                <td class="noBackground" style="width:10px; text-align: center;">
                {assign var='status' value=$media->getPublicationStatus()}
                {hasRight rule=medias_Edit}
                    {hasDocRight document=$media module="medias" rule="edit"}
                        {publicationStatusSwitch document=$media}
                    {hasDocRightElse}
                        {icon name=status/$status}
                    {/hasDocRight}
                {hasRightElse}
                    {icon name=status/$status}
                {/hasRight}
                </td>
                <td class="noBackground">
                    <span style="display:inline-block; width:16px;text-align:center">
                        <img src="{$media->getIcon(true)}" class="icon16" />
                    </span>
                    {if $media->isLink()}
                        {$media->getTitle()}
                    {else}
                        {$media->getFileNameWoExt()}.{$media->getExtension()}
                    {/if}
                </td>
                <td class="noBackground" style="width:100px; text-align:left">{if $media->isImage() || $media->isLink()}{$media->getWidth()} x {$media->getHeight()} pixels{else}/{/if}</td>
                <td class="noBackground" style="width:60px; text-align:right">{if $media->isLink()}/{else}{$media->getSize()}{/if}</td>
                <td class="noBackground" style="width:70px;">{$media->getFormattedMimeType()}</td>
                <td class="noBackground" style="width:100px;">{date date=$media->getCreationDate() smartformat="localized-data-time-format"}</td>
            </tr>
            {/foreach}
        </tbody>
    </table>
    <div id="result" style="display: none">&folderId={$folder->getUniqueId()}</div>
	<div id="selectResult" style="display: none"></div>

{literal}
<script language="type/javascript">
    column = "{/literal}{$sortParams.column}{literal}";
    order = "{/literal}{$sortParams.order}{literal}";
    searchValues = "{/literal}{$searchParams}{literal}";

    $(document).ready(function(){
        search();
        sort();
    });
</script>
{/literal}

    {/if}
	{elseif $tabName == "parameters"}
        {if count($parameters) == 0}
        <div class="emptyFolder">
            {icon name="info.png"} {t}No image dimensions for this folder{/t} - <a href="{$URL_RELATIVE}/bo/#{$newParamUrl}" class="greyButton nyroModal">{t}click here to add a new dimension{/t}</a> {t}for this folder{/t}.
        </div>
        {else}
  		<div id="saveButton" style="display:block" >
            <ul class="saveButtons">
                <li class="first">
                    <a href="{$URL_RELATIVE}/bo/#{$newParamUrl}" class="active openModal toolTip" title="{t}Formats - The format can resize pictures to fit specific dimensions. You can find the formats in editing images.{/t}">
                        {t assignTo=iconTitle}Add{/t}{icon name="format_add.png" title=$iconTitle} {t}Add dimension{/t}
                    </a>
                </li>
                <li>
                    <a href="{$URL_RELATIVE}/bo/#{url route='generateThumb' docId=$folder->getUniqueId() docLang=$folder->getLang()|lower}" class="{if $nbMedias > 0}active openModal{/if} toolTip" title="{t}Image generation - With this action you can generate all pictures dimention which are in auto generation. So if you change a dimension, click on this button and the new picture will be create.{/t}">
                        {t}Generate all pictures{/t}
                    </a>
                </li>
            </ul>
        </div>
		<table class="documentListTable">
			<thead>
				<tr>
					<th style="width:40px"><a href="javascript:void(0);">{t}Actions{/t}</a></th>
					<th style="width:70px"><a href="javascript:void(0);">{t}Auto. gen.{/t}</a></th>
					<th><a href="javascript:void(0);">{t}Label{/t}</a></th>
					<th><a href="javascript:void(0);">{t}Dimensions{/t}</a></th>
                    <th><a href="javascript:void(0);">{t}Resize mode use{/t}</a></th>
				</tr>
			</thead>
			<tbody class="documentListItems">
				{foreach from=$parameters item=parameter}
				<tr>
                    <td style="width:40px; text-align: center;">
                        {if $parameter->getFolderId() == $folder->getUniqueId()}
                        <span class="listButtons">
                            <a href="{$URL_RELATIVE}/bo/#{url route='deleteGeneric' moduleName=$parameter->getDocumentModuleName() docId=$parameter->getUniqueId() docLang=$parameter->getLang()}" class="nyroModal itemButton itemDeleteButton"></a>
                            <a href="{$URL_RELATIVE}/bo/#{$parameter->getEditUrl()}" class="nyroModal itemButton itemEditButton defaultAction"></a>
                        </span>
                        {/if}
                    </td>
					<td style="width:40px; text-align: center;">{if $parameter->isGenerateOnUpload()}{icon name="status/PUBLISHED.png"}{else}{icon name="status/DRAFT.png"}{/if}</td>
					<td>{$parameter->getLabel()}</td>
					<td>{$parameter->getWidth()}px / {$parameter->getHeight()}px</td>
                    {assign var='i' value=$parameter->getCrop()}
                    <td>{if $parameter->isGenerateOnUpload()}{$cropLabels.$i}{/if}</td>
				</tr>
				{/foreach}
			</tbody>
		</table>
		<script type="text/javascript">
			{literal}
			$(".openModal").click(function(event){
				// Catch the click
				event.preventDefault();
				href = $(this).attr("href").replace(/^.*#/, '');
				showModal("?module=backoffice&action=AjaxContext&href="+href);
			});
			{/literal}
		</script>
        {/if}
	{else}
		{block module="backoffice" action="editFolder"}
	{/if}
</div>